
<!doctype html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><title>Python: module simpleparse.dispatchprocessor</title>
</head><body bgcolor="#f0f0f8">

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="heading">
<tr bgcolor="#7799ee">
<td valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial">&nbsp;<br><big><big><strong><a href="simpleparse.html"><font color="#ffffff">simpleparse</font></a>.dispatchprocessor</strong></big></big></font></td
><td align=right valign=bottom
><font color="#ffffff" face="helvetica, arial"><a href=".">index</a><br><a href="file:/home/mcfletch/pylive/simpleparse/dispatchprocessor.py">/home/mcfletch/pylive/simpleparse/dispatchprocessor.py</a></font></td></tr></table>
    <p><tt>Dispatch-processor&nbsp;API<br>
&nbsp;<br>
This&nbsp;is&nbsp;a&nbsp;post-processing&nbsp;processor&nbsp;API&nbsp;based&nbsp;on&nbsp;dispatching<br>
each&nbsp;element&nbsp;of&nbsp;a&nbsp;result&nbsp;tree&nbsp;in&nbsp;a&nbsp;top-down&nbsp;recursive&nbsp;call<br>
structure.&nbsp;&nbsp;It&nbsp;is&nbsp;the&nbsp;API&nbsp;used&nbsp;by&nbsp;the&nbsp;SimpleParseGrammar&nbsp;Parser,<br>
and&nbsp;likely&nbsp;will&nbsp;be&nbsp;the&nbsp;default&nbsp;processor&nbsp;for&nbsp;SimpleParse.</tt></p>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
    
<tr><td bgcolor="#ee77aa"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl>
<dt><font face="helvetica, arial"><a href="simpleparse.processor.html#Processor">Processor</a>(<a href="simpleparse.processor.html#MethodSource">MethodSource</a>)
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="simpleparse.dispatchprocessor.html#DispatchProcessor">DispatchProcessor</a>
</font></dt></dl>
</dd>
</dl>
 <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="DispatchProcessor">class <strong>DispatchProcessor</strong></a>(<a href="simpleparse.processor.html#Processor">Processor</a>)</font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Dispatch&nbsp;results-tree&nbsp;in&nbsp;a&nbsp;top-down&nbsp;recursive&nbsp;pattern&nbsp;with<br>
attribute&nbsp;lookup&nbsp;to&nbsp;determine&nbsp;production&nbsp;-&gt;&nbsp;method&nbsp;correspondence.<br>
&nbsp;<br>
To&nbsp;use&nbsp;the&nbsp;class,&nbsp;subclass&nbsp;it,&nbsp;then&nbsp;define&nbsp;methods&nbsp;for<br>
processing&nbsp;each&nbsp;production.&nbsp;&nbsp;The&nbsp;methods&nbsp;should&nbsp;take&nbsp;this&nbsp;form:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;def&nbsp;production_name(&nbsp;self,&nbsp;(tag,&nbsp;left,&nbsp;right,&nbsp;children),&nbsp;buffer):<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pass<br>
Where&nbsp;children&nbsp;may&nbsp;be&nbsp;either&nbsp;a&nbsp;list,&nbsp;or&nbsp;None,&nbsp;and&nbsp;buffer&nbsp;is&nbsp;the<br>
entire&nbsp;buffer&nbsp;being&nbsp;parsed.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="simpleparse.dispatchprocessor.html#DispatchProcessor">DispatchProcessor</a></dd>
<dd><a href="simpleparse.processor.html#Processor">Processor</a></dd>
<dd><a href="simpleparse.processor.html#MethodSource">MethodSource</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="DispatchProcessor-__call__"><strong>__call__</strong></a>(self, value, buffer)</dt><dd><tt>Process&nbsp;the&nbsp;results&nbsp;of&nbsp;the&nbsp;parsing&nbsp;run&nbsp;over&nbsp;buffer<br>
&nbsp;<br>
Value&nbsp;can&nbsp;either&nbsp;be:&nbsp;(success,&nbsp;tags,&nbsp;next)&nbsp;for&nbsp;a&nbsp;top-level<br>
production,&nbsp;or&nbsp;(tag,&nbsp;left,&nbsp;right,&nbsp;children)&nbsp;for&nbsp;a&nbsp;non-top<br>
production.</tt></dd></dl>

<hr>
Methods inherited from <a href="simpleparse.processor.html#Processor">Processor</a>:<br>
<dl><dt><a name="DispatchProcessor-__repr__"><strong>__repr__</strong></a>(self)</dt><dd><tt>Return&nbsp;a&nbsp;representation&nbsp;of&nbsp;the&nbsp;class</tt></dd></dl>

</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Functions</strong></big></font></td></tr>
    
<tr><td bgcolor="#eeaa77"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><dl><dt><a name="-dispatch"><strong>dispatch</strong></a>(source, tag, buffer)</dt><dd><tt>Dispatch&nbsp;on&nbsp;source&nbsp;for&nbsp;tag&nbsp;with&nbsp;buffer<br>
&nbsp;<br>
Find&nbsp;the&nbsp;attribute&nbsp;or&nbsp;key&nbsp;tag[0]&nbsp;of&nbsp;source,<br>
then&nbsp;call&nbsp;it&nbsp;with&nbsp;(tag,&nbsp;buffer)</tt></dd></dl>
 <dl><dt><a name="-dispatchList"><strong>dispatchList</strong></a>(source, taglist, buffer)</dt><dd><tt>Dispatch&nbsp;on&nbsp;source&nbsp;for&nbsp;each&nbsp;tag&nbsp;in&nbsp;taglist&nbsp;with&nbsp;buffer</tt></dd></dl>
 <dl><dt><a name="-getString"><strong>getString</strong></a>((tag, left, right, sublist), buffer)</dt><dd><tt>Return&nbsp;the&nbsp;string&nbsp;value&nbsp;of&nbsp;the&nbsp;tag&nbsp;passed</tt></dd></dl>
 <dl><dt><a name="-lines"><strong>lines</strong></a>(start<font color="#909090">=None</font>, end<font color="#909090">=None</font>, buffer<font color="#909090">=None</font>)</dt><dd><tt>Return&nbsp;line&nbsp;number&nbsp;in&nbsp;file&nbsp;at&nbsp;character&nbsp;index&nbsp;(mx.TextTools&nbsp;version)</tt></dd></dl>
 <dl><dt><a name="-multiMap"><strong>multiMap</strong></a>(taglist, source<font color="#909090">=None</font>, buffer<font color="#909090">=None</font>)</dt><dd><tt>Convert&nbsp;a&nbsp;taglist&nbsp;to&nbsp;a&nbsp;mapping&nbsp;from&nbsp;tag-object:[list-of-tags]<br>
&nbsp;<br>
For&nbsp;instance,&nbsp;if&nbsp;you&nbsp;have&nbsp;items&nbsp;of&nbsp;3&nbsp;different&nbsp;types,&nbsp;in&nbsp;any&nbsp;order,<br>
you&nbsp;can&nbsp;retrieve&nbsp;them&nbsp;all&nbsp;sorted&nbsp;by&nbsp;type&nbsp;with&nbsp;multimap(&nbsp;childlist)<br>
then&nbsp;access&nbsp;them&nbsp;by&nbsp;tagobject&nbsp;key.</tt></dd></dl>
 <dl><dt><a name="-singleMap"><strong>singleMap</strong></a>(taglist, source<font color="#909090">=None</font>, buffer<font color="#909090">=None</font>)</dt><dd><tt>Convert&nbsp;a&nbsp;taglist&nbsp;to&nbsp;a&nbsp;mapping&nbsp;from&nbsp;tag-object:tag,&nbsp;overwritting&nbsp;early&nbsp;with&nbsp;late&nbsp;tags</tt></dd></dl>
</td></tr></table>
</body></html>